<template>
  <view class="container">
    <custom-CompanyInfo @onChange="getDepartmentsByEnterpriseId" />

    <view class="common-bg-white margin-t-tw">
      <block v-for="item in bossDepartments" :key="item.id">
        <view
          class="item between-item-center-row"
          @tap="handleItem"
          :data-item="item"
        >
          <view class="flex-row-align-center width-full">
            <p class="flex">{{ item.name }}</p>
            <!-- <p
              class="setting-dep"
              v-if="item.name == '人力部门'"
              @tap.stop="handleItem"
              :data-item="item"
              data-type="account"
            >
              账号管理
            </p> -->
            <image 
              class="edit-img"
              @tap.stop="handleEdit"
              :data-item="item"
              v-if="item.name != '人力部门'"
              src="https://talentsupload.oss-cn-beijing.aliyuncs.com/miniprogram/common/edit.png"
            />
          </view>
          <image
            class="arrow"
            src="https://talentsupload.oss-cn-beijing.aliyuncs.com/miniprogram/common/arrowRight.png"
          />
        </view>
      </block>
    </view>
    <view class="common-bg-white margin-t-tw">
      <block v-for="item in hrDepartments" :key="item.key">
        <view
          class="item between-item-center-row"
          @tap="handleItem"
          :data-item="item"
        >
          <view class="flex-row-align-center width-full">
            <p class="flex">{{ item.name }}</p>
            <image 
              class="edit-img"
              @tap.stop="handleEdit"
              :data-item="item"
              v-if="item.name != '人力部门'"
              src="https://talentsupload.oss-cn-beijing.aliyuncs.com/miniprogram/common/edit.png"
            />
          </view>
          <!-- <view>{{ item.name }}</view> -->
          
          <image
            class="arrow"
            src="https://talentsupload.oss-cn-beijing.aliyuncs.com/miniprogram/common/arrowRight.png"
          />
        </view>
      </block>
      <view 
        class="add" 
        @tap="handleAdd" 
        v-if="companyInfo.enterpriseId"
      >
        +
      </view>
    </view>

    <custom-emptyMsg 
      v-if="!companyInfo.enterpriseId"
      content="企业审核未通过，请联系管理员"
    />

    <custom-InputModal
      ref="inputModal"
      :hideTitle="true"
      :value="activeDep.name || ''"
      inputPlaceholder="请输入部门名称"
      @onConfirm="onConfirm"
    />
  </view>
</template>
<script src="./indexMod.js" />
<style src="./indexStyle.scss" lang="scss" scoped>
</style>